#ifndef ORDERMANAGER_H
#define ORDERMANAGER_H

#include <QDialog>
#include "orderstatuswidget.h"
#include"commentwidget.h"
#include<QItemSelection>


namespace Ui {
class orderManager;
}

class orderManager : public QDialog
{
    Q_OBJECT

public:
    explicit orderManager(QWidget *parent = 0, int userId = 0);
    ~orderManager();

private slots:
    void on_commentButton_clicked();

    void showOrderDetails(int orderId);

    OrderDetail fetchOrderDetails(int orderId);

    void processPayment(int orderId);  // 添加声明

    void on_showOrderButton_clicked();

    void loadOrderHistory(int userId);

     QVector<OrderSummary> fetchOrderList(int userId);

     void fetchOrderProducts(int orderId, QVector<ProductDetail> &products);

     void onTableSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);

private:
    Ui::orderManager *ui;
    orderStatusWidget * orderSW;
    commentWidget * CW;
    QSqlDatabase db;
    // 添加成员变量
    private:
        int m_currentUserId = -1; // 当前登录用户ID
        int m_currentOrderId = -1; // 当前选中的订单ID
};

#endif // ORDERMANAGER_H
